from numpy import zeros
from math import sin, cos, pi
import math

def vertexAndEdge(radius, x, y, z, numberOfVerticiesOnEdge=32):
    
    ni = numberOfVerticiesOnEdge
    nj = numberOfVerticiesOnEdge
    vertex = zeros(ni*nj*4, dtype='float32')
    for i in xrange(ni):
        theta = 2*math.pi*i/float(ni-1)
        for j in xrange(nj):
            phi = math.pi*(j+0.5)/float(nj)
            vertex[4*(i+ni*j)] = radius*math.sin(phi)*math.cos(theta) + x
            vertex[4*(i+ni*j)+1] = radius*math.cos(phi) + y
            vertex[4*(i+ni*j)+2] = radius*math.sin(phi)*math.sin(theta) + z
            vertex[4*(i+ni*j)+3] = 1


    triangle = zeros(6*(ni-1)*(nj-1), dtype='uint32')
    for i in xrange(ni-1):
        for j in xrange(nj-1):
            triangle[6*(i+(ni-1)*j)] = i+ni*j
            triangle[6*(i+(ni-1)*j)+1] = (i+1)+ni*j
            triangle[6*(i+(ni-1)*j)+2] = (i+1)+ni*(j+1)
            triangle[6*(i+(ni-1)*j)+3] = i+ni*j
            triangle[6*(i+(ni-1)*j)+4] = (i+1)+ni*(j+1)
            triangle[6*(i+(ni-1)*j)+5] = i+ni*(j+1)
    
    return vertex, triangle
